#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <iostream>
#include <thread>
#include <future>
using namespace std;
int port;
char* ipadd;
int main(int argc, char* argv[])
{
    port = atoi(argv[2]);
	ipadd = argv[1];
    struct sockaddr_in srvAddr;
    bzero(&srvAddr, sizeof(srvAddr));
    srvAddr.sin_family = AF_INET;
    srvAddr.sin_addr.s_addr = inet_addr(ipadd);
    srvAddr.sin_port = htons(port);
 
    int iSock = socket(AF_INET, SOCK_DGRAM, 0); // udp
    int i = 0;
    while(1)
    {
        sendto(iSock, "UDPpackage", strlen("UDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackageUDPpackage") + 1, 0, (struct sockaddr *)&srvAddr, sizeof(srvAddr));
    }
    close(iSock);
}
